import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect:'/home/index'
  },
  {
    path: '/home',
    name: 'home',
    component: HomeView,
    children:[
      {
        path: 'index',
        name: 'index',
        component: () => import('../views/index/Index.vue')
      },
      {
        path: 'women',
        name: 'women',
        component: () => import('../views/women/WoMen.vue'),
      },{
        path: "fuwu",
        name: "fuwu",
        component: () => import("../views/women/FuWu.vue"),
      },
      {
        path: "guoji",
        name: "guoji",
        component: () => import("../views/women/GuoJi.vue"),
      },
      {
        path: "fenzhi",
        name: "fenzhi",
        component: () => import("../views/women/FenZhi.vue"),
      },
      {
        path: "shipin",
        name: "shipin",
        component: () => import("../views/women/ShiPin.vue"),
      },
      {
        path: 'chanpin',
        name: 'chanpin',
        component: () => import('../views/chanpin/ChanPin.vue')
      },
      {
        path: 'chanpinliebiao/:type',
        name: 'chanpinliebiao',
        component: () => import('../views/chanpin/ChanPinliebiao.vue')
      },
      {
        path: 'cpxq/:id',
        name: 'cpxq',
        component: () => import('../views/chanpin/Cpxq.vue')
      },
      {
        path: 'select',
        name: 'select',
        component: () => import('../views/chanpin/Selecte.vue')
      },
      {
        path: 'gerenzhongxin/:id',
        name: 'gerenzhongxin',
        component: () => import('../views/gerenzhongxin/GeRenZhongXin.vue'),
        children: [
          {
            path: "mydingdan",
            name: "mydingdan",
            component: () =>
              import("../views/gerenzhongxin/Grzizujian/MyDingdan.vue"),
            children: [
              {
                path: "quanbu",
                name: "quanbu",
                component: () => import("../views/gerenzhongxin/Grzizujian/DingList/Quanbu.vue"),
              },
			  {
                path: "fukuan",
                name: "fukuan",
                component: () => import("../views/gerenzhongxin/Grzizujian/DingList/Daifu.vue"),
              },
			  {
                path: "paisong",
                name: "paisong",
                component: () => import("../views/gerenzhongxin/Grzizujian/DingList/Paisong.vue"),
              },
            ],
          },
          {
            path: "gerenxin",
            name: "mydingdan",
            component: () =>
              import("../views/gerenzhongxin/Grzizujian/GerenXin.vue"),
          },
          {
            path: "mima",
            name: "mydingdan",
            component: () =>
              import("../views/gerenzhongxin/Grzizujian/MiMa.vue"),
          },
          {
            path: "dizi",
            name: "mydingdan",
            component: () =>
              import("../views/gerenzhongxin/Grzizujian/DiZi.vue"),
              children:[{
                path: "shouhuo",
                name: "shouhuo",
                component: () => import("../views/gerenzhongxin/Grzizujian/DingList/shouHuo.vue")
              },
              {
                path: "xinzhedizhi",
                name: "xinzhedizhi",
                component: () => import("../views/gerenzhongxin/Grzizujian/DingList/xinZhengDizhi.vue")
              }
            ]
          },
        ],
      },
      {
        path: 'pinpai',
        name: 'pinpai',
        component: () => import('../views/pinpai/PinPai.vue')
      },
      {
        path: 'rongyu',
        name: 'rongyu',
        component: () => import('../views/pinpai/RongYu.vue')
      },
      {
        path: "chuancheng",
        name: "chuancheng",
        component: () => import("../views/pinpai/ChuanCheng.vue"),
      },
      {
        path: 'shop/:id',
        name: 'shop',
        component: () => import('../views/shop/shop.vue')
      },
    ]
  },
  {
    path: '/login',
    name: 'login',
    component: () => import('../views/login/Login.vue')
  },
  {
    path: '/logon',
    name: 'logon',
    component: () => import('../views/login/logon.vue')
  }
]


const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})
// router.beforeEach((to,from,next)=>{
//   let id = localStorage.getItem('userId')
//   if(to.path == "/home/shop")
// })

export default router
